<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
		<meta charset="utf-8" />
	<link href="css/style.css" rel="stylesheet" type="text/css" />



</head>


<body>

	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="#">实习单位管理</a></li>
    <li><a href="#">实习岗位信息</a></li>
    </ul>
    </div>
    <div class="rightinfo">
    <div class="tools">
     <form id="searchForm" class="form-search"
						action="jobinfo/jobinfo_page_list.do" method="post">
    	<ul class="seachform1">
    	<c:if test="${userRole <=2 }">
    		<li>选择院系：</li>  
    	    <li>
    	    <select name="XYDM" class="chosen-select col-xs-10 col-sm-5" >
						<option value="" > -- 全部 -- </option>
						<c:forEach items="${departmentInfoList}" var="departmentInfo">
							<option value="${departmentInfo.XYDM }" <c:if test="${departmentInfo.XYDM == XYDM }">selected</c:if> >${departmentInfo.XYMC }</option>
						</c:forEach>
					</select>
    	</li>
    	</c:if>
    	<c:if test="${userRole >2 }">
    	<li><input value="${departmentName }" name="XYDM" type="hidden">${departmentName } </li>
    	</c:if>
		<li><input name="JobName" value="${JobName}" type="text" class="scinput1" placeholder="输入岗位名称" /></li>
		<li><input  type="button" id="btnSearch"  class="scbtn" value="查询"/></li>  
		<input type="hidden" name="pageNumber" value="1" />
		<div class="clearfix"></div>
		</ul>	</form>
    	<ul class="toolbar">
    	<c:if test="${userRole <=3 }">
        <li class="click add"><span><img src="images/t01.png" /></span>添加</li>
        </c:if>
        <!--<li class="click"><span><img src="images/t02.png" /></span>修改</li>
        <li><span><img src="images/t03.png" /></span>删除</li>
        <li><span><img src="images/t04.png" /></span>统计</li>-->
        </ul>
    </div>
    <table class="tablelist">
    	<thead>
    	<tr>
    	<th>序号</th>
        <th>岗位名称</th>
        <th>岗位说明</th>
		<th>岗位要求</th>
        <th>操作</th>
      </tr>
        </thead>
        <tbody>
       <c:forEach items="${jobInfoList}" var="job"  varStatus="status">
        <tr>
          <td>${ status.index + 1}</td>
       		<td>${job.jobName}</td>
          <td>${job.jobIntroduce}</td>
          <td>${job.technicalAbilityNeed}</td>
          <td>
		<c:if test="${userRole<=3 }"><a onclick="edit('${job.id}')" style="cursor: pointer;">编辑</a>&nbsp;&nbsp;&nbsp;&nbsp;</c:if><a style="cursor: pointer;" onclick="ckdw('${job.id}');">查看单位</a><c:if test="${userRole<=3 }">&nbsp;&nbsp;&nbsp;&nbsp;<a style="cursor: pointer;" onclick="tjdw('${job.id}')">添加单位</a>&nbsp;&nbsp;&nbsp;&nbsp;<a onclick="deleteJob('${job.id}');" style="cursor: pointer;" >删除</a>&nbsp;&nbsp;&nbsp;&nbsp;</c:if></td>
      </tr> 
             </c:forEach>
        </tbody>
    </table>
    <div class="pagin">
    	<%@ include file="page.jsp"%>
    </div>
    </div>
    <script src="js/jquery-1.7.2.js"></script>
    <script src="layer/layer.js"></script>
    <script type="text/javascript">
    $('.tablelist tbody tr:odd').addClass('odd');
	$( "#btnSearch" ).on('click', function(e) {
		$("#searchForm").submit();
	});
	function GoToPage(toPage,totalPage) {
	    if(toPage<=0) return;
	    if(toPage>totalPage) return;
	    $("input[name='pageNumber']").val(toPage);
	    $("#searchForm").submit();
	};
	function closeAll() {
		layer.alert('添加成功!', {
			skin : 'layer-ext-moon'
		}, function() {
			layer.closeAll(); 
			 location.reload();
		}); 
	}
	function close() {
		layer.alert('修改成功!', {
			skin : 'layer-ext-moon'
		}, function() {
			layer.closeAll(); 
			 location.reload();
		}); 
	}
	$(".add").click(
	function  () {
		layer.open({
  type: 2,
  closeBtn: 2,
  title: '添加实习岗位信息',
  shadeClose: true,
  shade: 0.6,
  area: ['600px', '500px'],
  content: 'jobinfo/add_jobInfo.do',
  end: function () {
      location.reload();
  }
});
	}
	);
	
	function  edit(Id) {
	layer.open({
		  type: 2,
		  closeBtn: 2,
		  title: '编辑实习岗位信息',
		  shadeClose: true,
		  shade: 0.6,
		  area: ['600px', '500px'],
		  content: 'jobinfo/edit_jobInfo.do?Id='+Id,
		  end: function () {
		      location.reload();
		  }
		});
			}
	function deleteJob(Id) {
		$.ajax({
			type: "GET",
			url: "jobinfo/delete.do?Id="+Id,
			async: true,
			dataType: "json",
			success: function(data) {
				if("success" == data.result){
					layer.alert('删除成功!', {
			            skin: 'layer-ext-moon' 
					}, function(){
					 location.reload();
					 });
					}else {
						layer.alert('删除失败!', {
				            skin: 'layer-ext-moon' 
				        });
						}
				}
			})
	}
function ckdw(id){
	layer.open({
  type: 2,
    closeBtn: 2,
  title: '查看单位',
  shadeClose: true,
  shade: 0.8,
  area: ['90%', '300px'],
  content:'jobinfo/job_enter_list.do?Id='+id ,
  
}); 
	}
	function tjdw(id){
	layer.open({
  type: 2,
   closeBtn: 2,
  title: '添加单位',
  shadeClose: true,
  shade: 0.8,
  area: ['600px', '500px'],
  content:'jobinfo/add_enterpriseinfo.do?id='+id ,
}); 
	
	}

	
	</script>

</body>

</html>
